package com.qixin.total.controller;


import com.alibaba.fastjson.JSONObject;
import com.qixin.api.bean.ComCar;
import com.qixin.api.bean.ComChargeInfo;
import com.qixin.api.bean.ResultPage;
import com.qixin.api.bean.VoPage;
import com.qixin.api.service.ComChargeInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 充电记录表 前端控制器
 * </p>
 *
 * @author 吕正睿
 * @since 2018-10-29
 */
@Controller
@RequestMapping("/comChargeInfo")
public class ComChargeInfoController {
	private Logger logger = LoggerFactory.getLogger(ComPtUserController.class);
	@Autowired
	ComChargeInfoService comChargeInfoService;

	/*
	跳转界面
	 */
	@RequestMapping("/main.html")
	public String carftl() { return "renzheng/charge_record"; }

	/*/*
	跳转界面
	 */
	@RequestMapping("/money.html")
	public String moneydetail() { return "renzheng/money_detail"; }
	/*
	充电记录查询
	 */
	@RequestMapping("/list3")
	@ResponseBody
	public ResultPage<ComChargeInfo> list(VoPage voPage) {
		ResultPage<ComChargeInfo> resultPage= comChargeInfoService.selectMyPage3(voPage);
		return  resultPage;
	}
	/*
	资金明细查询
	 */   // TODO: 2018/11/17 错误！！！！！分配明细的模块 为什么要写在充电明细中？
/*	@RequestMapping("/list1")
	@ResponseBody
	public ResultPage<ComChargeInfo> list1(VoPage voPage,HttpSession session) {
		ResultPage<ComChargeInfo> resultPage= comChargeInfoService.selectMyPage1(voPage,session);
		return  resultPage;
	}*/
	/*
	充电记录查询
	 */
	@RequestMapping("/search")
	@ResponseBody
	public ResultPage<ComChargeInfo> search(VoPage voPage, Long startTime, Long endTime, Long phone, HttpSession session) {
		Map map=new HashMap();
		map.put("startTime",startTime);
		map.put("endTime",endTime);
		map.put("phone",phone);
		ResultPage<ComChargeInfo> resultPage= comChargeInfoService.search(map,voPage);
		return  resultPage;
	}
	/*
	资金明细查询
	 */
	@RequestMapping("/query")
	@ResponseBody
	public ResultPage<ComChargeInfo> query(VoPage voPage,String param){
		logger.info(param);
		Map map = JSONObject.parseObject(param);
		ResultPage<ComChargeInfo> resultPage=comChargeInfoService.query(map,voPage);
				return resultPage;
	}

	/*
	资金明细查询
	 */
	@RequestMapping("/list2")
	@ResponseBody
	public ResultPage<ComChargeInfo> list2(Map map,VoPage voPage) {
		ResultPage<ComChargeInfo> resultPage= comChargeInfoService.selectMoney(map,voPage);
		return  resultPage;
	}

}